<template>
    <view class="page-bolg-index">
        <view class="bg">
            <u-image :src="proxy.$icon.frame" width="198rpx" height="72rpx" class="float-right"></u-image>
        </view>
        <view class="info">
            <view class="flex-block">
                <view class="thumb">
                    <u-image width="120rpx" height="120rpx" :src="proxy.$util.getFullImage(userInfo.avatar)" shape="circle"></u-image>
                </view>
                <view class="content">
                    信用分：<text class="font-bold">{{ userInfo.creditScore }}</text>
                    · 赞：<text class="font-bold">{{ userInfo.likesCount }}</text> · 收藏：<text class="font-bold">{{ userInfo.favoritesCount }}</text>
                </view>
            </view>
            <view class="name">{{ userInfo.nickname || userInfo.username}}</view>
            <view class="intro">{{userInfo.intro || '这家伙有点懒，没有留下介绍' }}</view>
        </view>
        <view class="search-sticky">
            <u-row gutter="0">
                <u-col span="4" v-for="(item,index) in tab.list" :key="index">
                    <view class="text-center">
                        <view class="inline-block" :class="tab.current == index ? 'current' : ''" @click="changeTab(index)">
                            <text class="name">{{ item.name }}</text>
                        </view>
                    </view> 
                </u-col>
            </u-row>
        </view>
        <view class="list">
            <activity-list ref="refActivityList" v-show="tab.current == 0" />
            <creation-list ref="refCollectList" v-show="tab.current == 1" />
            <collect-list ref="refActivityList" v-show="tab.current == 2" />
        </view>
    </view>
</template>
<script setup lang="ts">
import ActivityList from './components/activityList';
import CollectList from './components/collectList';
import CreationList from './components/creationList';
let refActivityList = ref();
let refCollectList = ref();
let refCreationList = ref();
import {apiUrl} from '@/static/js/config';
import {onShow, onLoad } from '@dcloudio/uni-app';
import { useAppStore } from '@/stores/app';
const appStore = useAppStore();
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
let pageParams = reactive({});
let userInfo = ref({});
let tab = reactive({
	current: 0,
	list:[
		{id:1, name: '活动'},
		{id:2, name: '创作'},
		{id:3, name: '收藏'},
	]
});
const changeTab = (i) => {
	tab.current = i;
    
};
const getUserInfo = () => {
    proxy.$http('get', '/admin/appuser/noDetails/'+ pageParams.userId, {}, (data,msg) => {
        userInfo.value = data;
    })
}
onLoad(e => {
    pageParams = e;
});
onShow(() => {
    getUserInfo();
})
</script>
<!-- <style>
page{height:100%;background:#fff;}
</style> -->